<?php 
	namespace app\admin\controller;
	use think\Controller;
	use think\Session;
	use think\Db;

	//设置
	class Set extends Allow
	{
        //加载设置页面
		public function getIndex()
		{
            $d=Db::table("set")->order('sid desc')->limit(1)->select();
            $data=$d['0'];
			return $this->fetch('set/edit',['data'=>$data]);
		}
        
        //执行修改
		public function postUpdate()
		{
            //获取请求数据
            $request=request();
            $data=$request->only(['sid','notifyphone','notifymail']);
            $id=$data['sid'];
            //判断是否更新成功
            if(Db::table('set')->where('sid',"{$id}")->update($data))
            {
                $this->success('设置成功','/set/index');
            }else{

                $this->success('设置失败','/set/index');
            }                                
           
		}

	}
 ?>